package com.wjy.Seckill.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wjy.Seckill.entity.Commodity;
import com.wjy.Seckill.service.CommodityService;

@Controller
@RequestMapping("/commodity")
public class CommodityController {

	@Autowired
	private CommodityService commodityService;

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public String list(Model model) {
		return "commoditylist";
	}

	@RequestMapping(value = "/addCommodity", method = RequestMethod.POST)
	@ResponseBody
	public String add(@RequestBody Commodity commodity, HttpServletRequest request, HttpServletResponse response) {
		System.out.println(commodity.getCommodityName());
		System.out.println(request.getParameter("picture"));
		return null;

	}

}
